package com.hszh.common.service.packge.impl;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hszh.common.service.packge.WmsBoxTypeService;
import com.hszh.wms.mbg.packge.entity.WmsBoxType;
import com.hszh.wms.mbg.packge.mapper.WmsBoxTypeMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author niufw
 * @since 2021-02-27
 */
@Service
public class WmsBoxTypeServiceUnuseImpl  extends ServiceImpl<WmsBoxTypeMapper, WmsBoxType> implements WmsBoxTypeService
{
    @Autowired
    private WmsBoxTypeMapper boxTypeMapper;

    @Override
    public List<WmsBoxType> selectList() {

        return boxTypeMapper.selectList(null);
    }

    @Override
    public int insert(WmsBoxType boxType) {

        return boxTypeMapper.insert(boxType);
    }

    @Override
    public int updateById(Long id, WmsBoxType boxType) {
        boxType.setId(id);
        return boxTypeMapper.updateById(boxType);
    }

    @Override
    public int deleteById(Long id) {
        return boxTypeMapper.deleteById(id);
    }

    @Override
    public IPage<WmsBoxType> selectPage(int pageNum, int pageSize) {
        IPage<WmsBoxType> page = new Page<>(1, 5);
        return boxTypeMapper.selectPage(page,new QueryWrapper<WmsBoxType>().orderByDesc("id"));
    }

    @Override
    public WmsBoxType selectOne(Long id) {
        return boxTypeMapper.selectOne(new QueryWrapper<WmsBoxType>().eq("id",id));
    }
}
